#!/usr/bin/env python

from __future__ import print_function

import glob
import os
import shutil
import subprocess
import sys

TEST_FILE = 'test_python_startup.py'

for f in glob.glob('*.py[cod]'):
    os.remove(f)

shutil.rmtree('__pycache__', ignore_errors=True)

print('Running Python2 tests:')
py2tests = subprocess.call(['python2', TEST_FILE])

print('Running Python3 tests:')
py3tests = subprocess.call(['python3', TEST_FILE])

if py2tests != 0 or py3tests != 0:
    print('Tests failed.')
    sys.exit(1)
